﻿//
// IRobotControllerAsync.cs
//
// Authors:
//    Claus Jørgensen <10229@iha.dk>
//    Jens Bloch Christensen <09584@iha.dk>
//
using System;
using System.Diagnostics.Contracts;

namespace RSD.Robot
{
    /// <summary>
    /// Defines async versions various methods from <see cref="IRobotController"/>.
    /// </summary>
    [ContractClass(typeof(Contracts.IRobotControllerAsyncContract))]
    public interface IRobotControllerAsync
    {
        /// <summary>
        /// Finds the USB device connected to the robot and initializes the connection 
        /// between the robot and the computer, using the default <see cref="SystemType"/>.
        /// </summary>
        /// <param name="mode">Initialization mode.</param>
        /// <param name="callback">
        /// Callback which returns <c>true</c> if the method has been succesfully executed; otherwise, <c>false</c>.
        /// </param>
        void InitializationAsync(InitializationMode mode, Action<bool> callback = null);

        /// <summary>
        /// Finds the USB device connected to the robot and initializes the connection 
        /// between the robot and the computer.
        /// </summary>
        /// <param name="mode">Initialization mode.</param>
        /// <param name="systemType">System type.</param>
        /// <param name="callback">
        /// Callback which returns <c>true</c> if the method has been succesfully executed; otherwise, <c>false</c>.
        /// </param>
        void InitializationAsync(InitializationMode mode, SystemType systemType, Action<bool> callback = null);

        /// <summary>
        /// Homes the robot.
        /// </summary>
        /// <param name="axis">Axis to move.</param>
        /// <param name="callback">
        /// Callback which returns <c>true</c> if the method has been succesfully executed; otherwise, <c>false</c>.
        /// </param>
        void HomeAsync(Axis axis, Action<bool> callback = null);

        /// <summary>
        /// Moves the robot by joints.
        /// </summary>
        /// <param name="vector">Vector to move to.</param>
        /// <param name="callback">
        /// Callback which returns <c>true</c> if the method has been succesfully executed; otherwise, <c>false</c>.
        /// </param>
        void MoveJointAsync(Vector vector, Action<bool> callback = null);

        /// <summary>
        /// Moves the robot by joints.
        /// </summary>
        /// <param name="vectorA">First vector to move to.</param>
        /// <param name="vectorB">Second vector to move to.</param>
        /// <param name="callback">
        /// Callback which returns <c>true</c> if the method has been succesfully executed; otherwise, <c>false</c>.
        /// </param>
        void MoveJointAsync(Vector vectorA, Vector vectorB, Action<bool> callback = null);

        /// <summary>
        /// Moves the robot in a linear path.
        /// </summary>
        /// <param name="vector">Vector to move to.</param>
        /// <param name="callback">
        /// Callback which returns <c>true</c> if the method has been succesfully executed; otherwise, <c>false</c>.
        /// </param>
        void MoveLinearAsync(Vector vector, Action<bool> callback = null);

        /// <summary>
        /// Moves the robot in a linear path.
        /// </summary>
        /// <param name="vectorA">First vector to move to.</param>
        /// <param name="vectorB">Second vector to move to.</param>
        /// <param name="callback">
        /// Callback which returns <c>true</c> if the method has been succesfully executed; otherwise, <c>false</c>.
        /// </param>
        void MoveLinearAsync(Vector vectorA, Vector vectorB, Action<bool> callback = null);

        /// <summary>
        /// Moves the conveyor belt.
        /// </summary>
        /// <param name="velocity">Speed/direction of the conveyor belt.</param>
        /// <param name="callback">
        /// Callback which returns <c>true</c> if the method has been succesfully executed; otherwise, <c>false</c>.
        /// </param>
        void MoveConveyorBeltAsync(int velocity, Action<bool> callback = null);

        /// <summary>
        /// Opens the gripper.
        /// </summary>
        /// <param name="callback">
        /// Callback which returns <c>true</c> if the method has been succesfully executed; otherwise, <c>false</c>.
        /// </param>
        void OpenGripperAsync(Action<bool> callback = null);

        /// <summary>
        /// Closes the gripper.
        /// </summary>
        /// <param name="callback">
        /// Callback which returns <c>true</c> if the method has been succesfully executed; otherwise, <c>false</c>.
        /// </param>
        void CloseGripperAsync(Action<bool> callback = null);
    }
}
